package com.elbis.business.util;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public class ErrorMessageUtil {

	private ErrorMessageUtil() {
	}

	public static void addErrorMessage(String id, String message) {
		FacesMessage fm = new FacesMessage(message);
		FacesContext context = FacesContext.getCurrentInstance();
		context.addMessage(id, fm);
	}

	public static void addErrorMessage(String message) {
		FacesMessage fm = new FacesMessage(message);
		FacesContext context = FacesContext.getCurrentInstance();
		context.addMessage(null, fm);
	}

	public static void addInformativeMessage(String message) {
		FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_INFO, message,
				null);
		FacesContext context = FacesContext.getCurrentInstance();
		context.addMessage(null, fm);
	}
	
	public static void addInformativeMessage(String id, String message) {
		FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_INFO, message,
				null);
		FacesContext context = FacesContext.getCurrentInstance();
		context.addMessage(id, fm);
	}

}
